<template>
  <div class="quickStartBg" @click.stop>
    <div class="windowBox" v-if="Object.keys(pageData).length>0" :style="{ top: pageData.popupOptions[0], right: pageData.popupOptions[1] }">
      <el-button type="primary" style="background-color: #3d5ce4; width: 80px;" @click="startSet">{{
        pageData.btnName }}</el-button>
      <div class="tipsBox" :style="{ right: pageData.popupOptions[2] }">
        <div class="triangle" :style="{ right: pageData.popupOptions[3] }"></div>
        <div class="title">{{ pageData.title }}</div>
        <div class="desc">{{ pageData.desc }}</div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { onMounted, ref } from "vue"
import { dataSetStore } from 'src/stores/dataSet'
import { quickStartData } from 'src/utils/useData';
import { useRouter } from 'vue-router';
const router = useRouter()
const projectId = router.currentRoute.value.params.project_id
const store = dataSetStore()
const pageData = ref(<any>{})
onMounted(() => {

  if(store.quickStart.flowNumber==5&&store.quickStart.detailFlow==2){
    pageData.value = quickStartData[store.quickStart.flowNumber+1]
  }else{
    pageData.value = quickStartData[store.quickStart.flowNumber]
  }
})
function startSet() {
  if(pageData.value.nextPagePath!='featureset'&&pageData.value.nextPagePath!='model-app'){
    router.push({ name: pageData.value.nextPagePath, params: { project_id: projectId } })
  }
  store.setQuickStart({ tipsPopup: false, quickFlow: true, flowNumber: store.quickStart.flowNumber,detailFlow:1 })
}
</script>

<style scoped lang="scss">
.quickStartBg {
  width: 100vw;
  height: 100vh;
  position: fixed;
  z-index: 99999;
  top: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.6);

  .windowBox {
    width: 100px;
    height: 50px;
    background: white;
    position: absolute;
    right: 110px;
    top: 165px;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;

    .tipsBox {
      position: absolute;
      width: 284px;
      min-height: 102px;
      background: white;
      border-radius: 4px;
      padding: 16px;
      top: 70px;
      right: -25px;

      .title {
        font-weight: bold;
        font-size: 16px;
        margin-bottom: 12px;
        color: #333333;
      }

      .desc {
        font-size: 14px;
        color: #666666;
      }

      .triangle {
        position: absolute;
        width: 0;
        height: 0;
        top: -7px;
        right: 40px;
        border-bottom: 7px solid white;
        border-right: 7px solid transparent;
        border-left: 7px solid transparent;
      }
    }
  }
}
</style>
